package NGUYENVANTHANG.ptbac2;



public class Models {
	 public String check(double a,double b,double c){
	String result = "" ; 
	double x = 0;
	double x1 = 0;
	 double x2;
		if(a==0)
	    {
			if(b==0)
	            {
	                if(c==0)
	                	result = "phuong trinh da cho co vo so nghiem";
	                else
	                	result ="phuong trinh da cho vo nghiem";
	            }
			
	        else
	        x = -c/b;
			result = "phuong trinh da cho co nghiem la  " + x;
	    }
	    else
	    {
	       
			double d = (double) (b*b-4*a*c);
	       
			if (d<0)
	        	result = "phuong trinh da cho vo nghiem!!!";
	        
	        else if (d==0)
	        	result = "phuong trinh da cho co nghiem kep la  ";
	        else
	        	x1 = (-b+Math.sqrt(d))/(2*a);
	        x2 = (-b-Math.sqrt(d))/(2*a);
	        	result ="phuong trinh co 2 nghiem la " + x1 + " va " + x2 ;    
	    } 
	 return  result;
	        }
	 }
